package com.bw.controller;


import com.bw.common.resp.ResponseResult;
import com.bw.entity.TbGood;
import com.bw.service.ITbGoodService;
import com.bw.service.ITbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ghq
 * @since 2020-05-31
 */
@RestController
@RequestMapping("/good")
public class TbGoodController {
    @Autowired
    private ITbGoodService goodService;

    @GetMapping("/goodlist")
    public ResponseResult list(){
        ResponseResult result = ResponseResult.SUCCESS();
        try {
            List<TbGood> list = goodService.list();
            result.setResult(list);
        }catch (Exception e){
            result.setSuccess(false);
            result.setMessage("查询失败");
        }
        return result;
    }
}
